package com.sg.service.biz.app.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.base.app.req.QueryContTagRcordDetailReq;
import com.sg.dto.base.app.req.QueryContTagRcordListReq;
import com.sg.dto.base.app.req.QueryTargetObjPlanExDetailReq;
import com.sg.dto.base.app.req.QueryUnrestraintObjtiveDetailReq;
import com.sg.dto.biz.app.req.*;
import com.sg.dto.biz.app.res.*;
import com.sg.dto.integration.framework.AddObjectTagComReqDto;
import com.sg.dto.integration.framework.AddObjectTagComRespDto;
import com.sg.dto.integration.framework.QuerySpaceDetailComReqDto;
import com.sg.dto.integration.framework.QuerySpaceDetailComRespDto;
import com.sg.entity.OmsBasicContentTagRecord;
import com.sg.entity.OmsTargetObjective;
import com.sg.entity.OmsTargetObjectivePlanExtend;
import com.sg.service.base.app.*;
import com.sg.service.biz.app.TargetContentService;
import com.sg.service.biz.app.nb.NbContTagRcord;
import com.sg.common.exception.Assert;
import com.wicket.okrframework.integration.BaseService;
import com.wicket.okrframework.integration.TagService;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class ContTagRcordServiceImpl implements com.wicket.okrapp.biz.service.ContTagRcordService {
    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MOmsBasicContentTagRecordService mOmsBasicContentTagRecordService;
    @Resource
    private MOmsTargetObjectiveService mOmsTargetObjectiveService;
    @Resource
    private MOmsEvaBatchRelatedSetService mOmsEvaBatchRelatedSetService;
    @Resource
    private MOmsTargetObjectivePlanExtendService mOmsTargetObjectivePlanExtendService;
    @Resource
    private NbContTagRcord nbContTagRcord;
    @Resource
    private TargetContentService targetContentService;
    @Resource
    private TagService fwBaseTagClient;
    @Resource
    private MOmsEvaluationObjectTargetCycleService mOmsEvaluationObjectTargetCycleService;
    @Resource
    private BaseService baseService;
//@Resource
    //private undefinedService undefinedService;

    /**
     * D3-13查业务应用内容标签记录列表[2244]
     * gen by moon at 10/22/2022, 9:04:31 PM
     */
    @Trace(operationName = "D3-13查业务应用内容标签记录列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryContTagRcordListRespDto queryContTagRcordList(QueryContTagRcordListReqDto reqDto) {


        List<OmsBasicContentTagRecord> listOmsBasicContentTagRecord_1 = new ArrayList<>();
//步骤0: 3-13-04查业务应用内容标签记录列表 - queryContTagRcordList
        List<OmsBasicContentTagRecord> listOmsBasicContentTagRecord = new ArrayList<>();
        QueryContTagRcordListReq queryContTagRcordListReq = new QueryContTagRcordListReq();
        queryContTagRcordListReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:65551_1
        if (reqDto != null) {
            queryContTagRcordListReq.setTagName(reqDto.getTagName());//SimpleFieldAssign//sourceId:65543_1
            queryContTagRcordListReq.setBizAppContentCode(reqDto.getBizAppContentCode());//SimpleFieldAssign//sourceId:65544_1
            queryContTagRcordListReq.setObjectContentId(reqDto.getObjectContentId());//SimpleFieldAssign//sourceId:65545_1
            queryContTagRcordListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:65546_1
            queryContTagRcordListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:65547_1
        }

        /*3-13-04查业务应用内容标签记录列表[2243]   */
        Assert.isNull(queryContTagRcordListReq.getSpaceId(), "D3-13查业务应用内容标签记录列表-3-13-04查业务应用内容标签记录列表-创建于空间ID不能为空", false);
        listOmsBasicContentTagRecord = mOmsBasicContentTagRecordService.queryContTagRcordList(queryContTagRcordListReq);


        listOmsBasicContentTagRecord_1 = listOmsBasicContentTagRecord;

        QueryContTagRcordListRespDto retData = new QueryContTagRcordListRespDto();
        retData.setContTagRcordList(listOmsBasicContentTagRecord_1.stream().map(item -> BeanUtil.toBean(item, ContTagRcordDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:65558_1


        return retData;
    }

    /**
     * D3执行指标模板责任主体标签记录处理(公共)[5963]
     * gen by moon at 6/16/2024, 2:53:14 AM
     */
    @Trace(operationName = "D3执行指标模板责任主体标签记录处理(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementObjtiveSubjectBodyTagRcordDisposeComRespDto implementObjtiveSubjectBodyTagRcordDisposeCom(ImplementObjtiveSubjectBodyTagRcordDisposeComReqDto reqDto) {


        //virtualUsage 3-3-03查指标模板ID(无约束）  30972
        OmsTargetObjective omsTargetObjective = null;
        QueryUnrestraintObjtiveDetailReq queryUnrestraintObjtiveDetailReq = new QueryUnrestraintObjtiveDetailReq();
        queryUnrestraintObjtiveDetailReq.setIsArchive("FALSE");//sourceId:693223_1_30972
        if (reqDto != null) {
            queryUnrestraintObjtiveDetailReq.setObjectiveId(reqDto.getObjectiveId());//SimpleFieldAssign//sourceId:693221_1_30972
            queryUnrestraintObjtiveDetailReq.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:693222_1_30972
        }

        /*3-3-03查指标模板ID(无约束）[5964]   */
        Assert.isNull(queryUnrestraintObjtiveDetailReq.getObjectiveId(), "D3执行指标模板责任主体标签记录处理(公共)-3-3-03查指标模板ID(无约束）-指标ID不能为空", false);
        Assert.isNull(queryUnrestraintObjtiveDetailReq.getEvaluationTemplateId(), "D3执行指标模板责任主体标签记录处理(公共)-3-3-03查指标模板ID(无约束）-冗余评价模板ID不能为空", false);
        Assert.isNull(queryUnrestraintObjtiveDetailReq.getIsArchive(), "D3执行指标模板责任主体标签记录处理(公共)-3-3-03查指标模板ID(无约束）-是否存档不能为空", false);
        omsTargetObjective = mOmsTargetObjectiveService.queryUnrestraintObjtiveDetail(queryUnrestraintObjtiveDetailReq)/*vcase invoke 本地 method 方法调用;*/;


//virtualUsage M3业务应用公共字段推送内存  30973
        //ModelCode: publicFieldCache
        ImplementBizPublicFieldPushMemoryRespDto publicFieldCacheRes = null;
        if (omsTargetObjective != null) {
            ImplementBizPublicFieldPushMemoryReqDto publicFieldCacheReq = new ImplementBizPublicFieldPushMemoryReqDto();
            if (omsTargetObjective != null) {
                publicFieldCacheReq.setCreateInductionId(omsTargetObjective.getCreateInductionId());//SimpleFieldAssign//sourceId:693193_1_30973
                publicFieldCacheReq.setSpaceId(omsTargetObjective.getSpaceId());//SimpleFieldAssign//sourceId:693194_1_30973
                publicFieldCacheReq.setAppId(omsTargetObjective.getAppId());//SimpleFieldAssign//sourceId:693195_1_30973
            }

            /*M3业务应用公共字段推送内存[4520]  用于定时任务执行时，获取定时任务执行所需的公共信息，存入缓存，供定时任务中虚拟用况使用 */

            publicFieldCacheRes = nbContTagRcord.implementBizPublicFieldPushMemory(publicFieldCacheReq);


        }
//virtualUsage D1-2查当前空间简称  43080
        QuerySpaceDetailComRespDto querySpaceDetailComRespDto = null;
        if (omsTargetObjective != null) {
            QuerySpaceDetailComReqDto querySpaceDetailComReqDto = new QuerySpaceDetailComReqDto();
            if (omsTargetObjective != null) {
                querySpaceDetailComReqDto.setSpaceId(omsTargetObjective.getSpaceId());//SimpleFieldAssign//sourceId:983616_1_43080
            }

            /*D1-2查当前空间简称[402]   */
            Assert.isNull(querySpaceDetailComReqDto.getSpaceId(), "D3执行指标模板责任主体标签记录处理(公共)-D1-2查当前空间简称-空间ID不能为空", false);
            querySpaceDetailComRespDto = baseService.querySpaceDetailCom(querySpaceDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }
//virtualUsage 3-13-04查指标模板与部门的标签记录（确认是否存在）  43081
        OmsBasicContentTagRecord omsBasicContentTagRecord = null;
        if (querySpaceDetailComRespDto != null && omsTargetObjective != null) {
            QueryContTagRcordDetailReq queryContTagRcordDetailReq = new QueryContTagRcordDetailReq();
            queryContTagRcordDetailReq.setBizAppContentCode("OBJECTIVE_TEMPLATE");//sourceId:693156_1_43081
            queryContTagRcordDetailReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:693158_1_43081
            if (querySpaceDetailComRespDto != null) {
                queryContTagRcordDetailReq.setTagName(querySpaceDetailComRespDto.getAbbreviation());//SimpleFieldAssign//sourceId:693155_1_43081
            }
            if (omsTargetObjective != null) {
                queryContTagRcordDetailReq.setObjectContentId(omsTargetObjective.getObjectiveTemplateId());//SimpleFieldAssign//sourceId:693157_1_43081
            }

            /*3-13-04查指标模板与部门的标签记录（确认是否存在）[4717]   */
            Assert.isNull(queryContTagRcordDetailReq.getTagName(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-标签名称不能为空", false);
            Assert.isNull(queryContTagRcordDetailReq.getBizAppContentCode(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-业务应用内容类型编码不能为空", false);
            Assert.isNull(queryContTagRcordDetailReq.getObjectContentId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-标签内容ID不能为空", false);
            Assert.isNull(queryContTagRcordDetailReq.getSpaceId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-创建于空间ID不能为空", false);
            omsBasicContentTagRecord = mOmsBasicContentTagRecordService.queryContTagRcordDetail(queryContTagRcordDetailReq)/*vcase invoke 本地 method 方法调用;*/;


        }
        if ((omsBasicContentTagRecord == null)) {
            //if(3-13-04查指标模板与空间的标签记录（确认是否存在）.出参 值等于空 )  43082

            AddObjectTagComRespDto addObjectTagComRespDto = null;
            if (querySpaceDetailComRespDto != null) {
                AddObjectTagComReqDto addObjectTagComReqDto = new AddObjectTagComReqDto();
                addObjectTagComReqDto.setTagSource("CREATE_SELF");//sourceId:693178_1_43083
                addObjectTagComReqDto.setIsRecommend("FALSE");//sourceId:693181_1_43083
                addObjectTagComReqDto.setBizAppCode("TARGET_TEMPLATE_APP");//CUSTOM_CONVENTION//sourceId:693183_1_43083
                addObjectTagComReqDto.setBusinessSceneCode("OBJECTIVE_TEMP_MGT");//CUSTOM_CONVENTION//sourceId:693182_1_43083
                if (querySpaceDetailComRespDto != null) {
                    addObjectTagComReqDto.setTagName(querySpaceDetailComRespDto.getAbbreviation());//SimpleFieldAssign//sourceId:693177_1_43083
                }

                /*D1-1新增指标模板标签(公共)[2757]   */
                Assert.isNull(addObjectTagComReqDto.getTagName(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-标签名称不能为空", false);
                Assert.isNull(addObjectTagComReqDto.getTagSource(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-标签来源方式不能为空", false);
                Assert.isNull(addObjectTagComReqDto.getIsRecommend(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-是否推荐不能为空", false);
                Assert.isNull(addObjectTagComReqDto.getBizAppCode(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-归属业务应用标识不能为空", false);
                Assert.isNull(addObjectTagComReqDto.getBusinessSceneCode(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-归属业务场景标识不能为空", false);
                addObjectTagComRespDto = fwBaseTagClient.addObjectTagCom(addObjectTagComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            }
            String string = null;
            if (addObjectTagComRespDto != null && omsTargetObjective != null) {
                OmsBasicContentTagRecord omsBasicContentTagRecord_2 = new OmsBasicContentTagRecord();
                omsBasicContentTagRecord_2.setBizAppContentCode("OBJECTIVE_TEMPLATE");//sourceId:693185_1_43084
                omsBasicContentTagRecord_2.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:693187_1_43084
                omsBasicContentTagRecord_2.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:693188_1_43084
                omsBasicContentTagRecord_2.setReleaseTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:693189_1_43084
                if (addObjectTagComRespDto != null) {
                    omsBasicContentTagRecord_2.setTagName(addObjectTagComRespDto.getTagName());//SimpleFieldAssign//sourceId:693184_1_43084
                }
                if (omsTargetObjective != null) {
                    omsBasicContentTagRecord_2.setObjectContentId(omsTargetObjective.getObjectiveTemplateId());//SimpleFieldAssign//sourceId:693186_1_43084
                }

                /*3-13-04新增指标模板标签记录（部门）[2758]   */
                Assert.isNull(omsBasicContentTagRecord_2.getTagName(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-标签名称不能为空", false);
                Assert.isNull(omsBasicContentTagRecord_2.getObjectContentId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-标签内容ID不能为空", false);
                Assert.isNull(omsBasicContentTagRecord_2.getBizAppContentCode(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-业务应用内容类型编码不能为空", false);
                Assert.isNull(omsBasicContentTagRecord_2.getSubjectLifeCycle(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-主体生命周期不能为空", false);
                Assert.isNull(omsBasicContentTagRecord_2.getReleaseInductionId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-发布人就职记录ID不能为空", false);
                Assert.isNull(omsBasicContentTagRecord_2.getReleaseTime(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-发布时间不能为空", false);
                string = mOmsBasicContentTagRecordService.addContTagRcord(omsBasicContentTagRecord_2)/*vcase invoke 本地 method 方法调用;*/;


            }
        }
//virtualUsage 3-3-05查指标责任主体类型  30974
        OmsTargetObjectivePlanExtend omsTargetObjectivePlanExtend = null;
        QueryTargetObjPlanExDetailReq queryTargetObjPlanExDetailReq = new QueryTargetObjPlanExDetailReq();
        queryTargetObjPlanExDetailReq.setArchivngType("NOT_ARCHIVE");//sourceId:693040_1_30974
        queryTargetObjPlanExDetailReq.setIsArchive("FALSE");//sourceId:693033_1_30974
        if (reqDto != null) {
            queryTargetObjPlanExDetailReq.setObjectiveId(reqDto.getObjectiveId());//SimpleFieldAssign//sourceId:693020_1_30974
            queryTargetObjPlanExDetailReq.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:693041_1_30974
        }

        /*3-3-05查指标责任主体类型[2725]   */
        Assert.isNull(queryTargetObjPlanExDetailReq.getObjectiveId(), "D3执行指标模板责任主体标签记录处理(公共)-3-3-05查指标责任主体类型-归属指标ID不能为空", false);
        Assert.isNull(queryTargetObjPlanExDetailReq.getEvaluationTemplateId(), "D3执行指标模板责任主体标签记录处理(公共)-3-3-05查指标责任主体类型-冗余评价模板ID不能为空", false);
        Assert.isNull(queryTargetObjPlanExDetailReq.getArchivngType(), "D3执行指标模板责任主体标签记录处理(公共)-3-3-05查指标责任主体类型-存档类型不能为空", false);
        Assert.isNull(queryTargetObjPlanExDetailReq.getIsArchive(), "D3执行指标模板责任主体标签记录处理(公共)-3-3-05查指标责任主体类型-是否存档不能为空", false);
        omsTargetObjectivePlanExtend = mOmsTargetObjectivePlanExtendService.queryTargetObjPlanExDetail(queryTargetObjPlanExDetailReq)/*vcase invoke 本地 method 方法调用;*/;


        if ((omsTargetObjectivePlanExtend != null && omsTargetObjectivePlanExtend.getRespBodyType() != null && omsTargetObjectivePlanExtend.getRespBodyType().equals("DEPT"))) {
            //if(3-3-05查指标责任主体类型.责任主体类型 等于 部门)  30959

            QueryAnalyseObjectiveLeadDeptDetailComRespDto queryAnalyseObjectiveLeadDeptDetailComRespDto = null;
            QueryAnalyseObjectiveLeadDeptDetailComReqDto queryAnalyseObjectiveLeadDeptDetailComReqDto = new QueryAnalyseObjectiveLeadDeptDetailComReqDto();
            if (reqDto != null) {
                queryAnalyseObjectiveLeadDeptDetailComReqDto.setEntityId(reqDto.getObjectiveId());//SimpleFieldAssign//sourceId:693295_1_30975
                queryAnalyseObjectiveLeadDeptDetailComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:693296_1_30975
            }

            /*D3查指标牵头部门(公共)[5965]   */
            Assert.isNull(queryAnalyseObjectiveLeadDeptDetailComReqDto.getEntityId(), "D3执行指标模板责任主体标签记录处理(公共)-D3查指标牵头部门(公共)-冗余内容表主键ID不能为空", false);
            Assert.isNull(queryAnalyseObjectiveLeadDeptDetailComReqDto.getEvaluationTemplateId(), "D3执行指标模板责任主体标签记录处理(公共)-D3查指标牵头部门(公共)-归属对象ID不能为空", false);
            queryAnalyseObjectiveLeadDeptDetailComRespDto = targetContentService.queryAnalyseObjectiveLeadDeptDetailCom(queryAnalyseObjectiveLeadDeptDetailComReqDto)/*vcase invoke isSameApp*/;


            OmsBasicContentTagRecord omsBasicContentTagRecord_3 = null;
            if (queryAnalyseObjectiveLeadDeptDetailComRespDto != null && omsTargetObjective != null) {
                QueryContTagRcordDetailReq queryContTagRcordDetailReq_1 = new QueryContTagRcordDetailReq();
                queryContTagRcordDetailReq_1.setBizAppContentCode("OBJECTIVE_TEMPLATE");//sourceId:693156_1_30967
                queryContTagRcordDetailReq_1.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:693158_1_30967
                if (queryAnalyseObjectiveLeadDeptDetailComRespDto != null) {
                    queryContTagRcordDetailReq_1.setTagName(queryAnalyseObjectiveLeadDeptDetailComRespDto.getDeptShortName());//SimpleFieldAssign//sourceId:693155_1_30967
                }
                if (omsTargetObjective != null) {
                    queryContTagRcordDetailReq_1.setObjectContentId(omsTargetObjective.getObjectiveTemplateId());//SimpleFieldAssign//sourceId:693157_1_30967
                }

                /*3-13-04查指标模板与部门的标签记录（确认是否存在）[4717]   */
                Assert.isNull(queryContTagRcordDetailReq_1.getTagName(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-标签名称不能为空", false);
                Assert.isNull(queryContTagRcordDetailReq_1.getBizAppContentCode(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-业务应用内容类型编码不能为空", false);
                Assert.isNull(queryContTagRcordDetailReq_1.getObjectContentId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-标签内容ID不能为空", false);
                Assert.isNull(queryContTagRcordDetailReq_1.getSpaceId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04查指标模板与部门的标签记录（确认是否存在）-创建于空间ID不能为空", false);
                omsBasicContentTagRecord_3 = mOmsBasicContentTagRecordService.queryContTagRcordDetail(queryContTagRcordDetailReq_1)/*vcase invoke 本地 method 方法调用;*/;


            }
            if ((omsBasicContentTagRecord_3 == null)) {
                //if(3-13-04查指标模板与部门的标签记录（确认是否存在）.出参 值等于空 )  30968

                AddObjectTagComRespDto addObjectTagComRespDto_2 = null;
                if (queryAnalyseObjectiveLeadDeptDetailComRespDto != null) {
                    AddObjectTagComReqDto addObjectTagComReqDto_1 = new AddObjectTagComReqDto();
                    addObjectTagComReqDto_1.setTagSource("CREATE_SELF");//sourceId:693178_1_30969
                    addObjectTagComReqDto_1.setIsRecommend("FALSE");//sourceId:693181_1_30969
                    addObjectTagComReqDto_1.setBizAppCode("TARGET_TEMPLATE_APP");//CUSTOM_CONVENTION//sourceId:693183_1_30969
                    addObjectTagComReqDto_1.setBusinessSceneCode("OBJECTIVE_TEMP_MGT");//CUSTOM_CONVENTION//sourceId:693182_1_30969
                    if (queryAnalyseObjectiveLeadDeptDetailComRespDto != null) {
                        addObjectTagComReqDto_1.setTagName(queryAnalyseObjectiveLeadDeptDetailComRespDto.getDeptShortName());//SimpleFieldAssign//sourceId:693177_1_30969
                    }

                    /*D1-1新增指标模板标签(公共)[2757]   */
                    Assert.isNull(addObjectTagComReqDto_1.getTagName(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-标签名称不能为空", false);
                    Assert.isNull(addObjectTagComReqDto_1.getTagSource(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-标签来源方式不能为空", false);
                    Assert.isNull(addObjectTagComReqDto_1.getIsRecommend(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-是否推荐不能为空", false);
                    Assert.isNull(addObjectTagComReqDto_1.getBizAppCode(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-归属业务应用标识不能为空", false);
                    Assert.isNull(addObjectTagComReqDto_1.getBusinessSceneCode(), "D3执行指标模板责任主体标签记录处理(公共)-D1-1新增指标模板标签(公共)-归属业务场景标识不能为空", false);
                    addObjectTagComRespDto_2 = fwBaseTagClient.addObjectTagCom(addObjectTagComReqDto_1).getData()/*vcase invoke 跨dubbo调用;*/;


                }
                String string_2 = null;
                if (addObjectTagComRespDto_2 != null && omsTargetObjective != null) {
                    OmsBasicContentTagRecord omsBasicContentTagRecord_4 = new OmsBasicContentTagRecord();
                    omsBasicContentTagRecord_4.setBizAppContentCode("OBJECTIVE_TEMPLATE");//sourceId:693185_1_30970
                    omsBasicContentTagRecord_4.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:693187_1_30970
                    omsBasicContentTagRecord_4.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:693188_1_30970
                    omsBasicContentTagRecord_4.setReleaseTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:693189_1_30970
                    if (addObjectTagComRespDto_2 != null) {
                        omsBasicContentTagRecord_4.setTagName(addObjectTagComRespDto_2.getTagName());//SimpleFieldAssign//sourceId:693184_1_30970
                    }
                    if (omsTargetObjective != null) {
                        omsBasicContentTagRecord_4.setObjectContentId(omsTargetObjective.getObjectiveTemplateId());//SimpleFieldAssign//sourceId:693186_1_30970
                    }

                    /*3-13-04新增指标模板标签记录（部门）[2758]   */
                    Assert.isNull(omsBasicContentTagRecord_4.getTagName(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-标签名称不能为空", false);
                    Assert.isNull(omsBasicContentTagRecord_4.getObjectContentId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-标签内容ID不能为空", false);
                    Assert.isNull(omsBasicContentTagRecord_4.getBizAppContentCode(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-业务应用内容类型编码不能为空", false);
                    Assert.isNull(omsBasicContentTagRecord_4.getSubjectLifeCycle(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-主体生命周期不能为空", false);
                    Assert.isNull(omsBasicContentTagRecord_4.getReleaseInductionId(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-发布人就职记录ID不能为空", false);
                    Assert.isNull(omsBasicContentTagRecord_4.getReleaseTime(), "D3执行指标模板责任主体标签记录处理(公共)-3-13-04新增指标模板标签记录（部门）-发布时间不能为空", false);
                    string_2 = mOmsBasicContentTagRecordService.addContTagRcord(omsBasicContentTagRecord_4)/*vcase invoke 本地 method 方法调用;*/;


                }
            }
        } else if ((omsTargetObjectivePlanExtend != null && omsTargetObjectivePlanExtend.getRespBodyType() != null && omsTargetObjectivePlanExtend.getRespBodyType().equals("PERSONAL"))) {
            //elseif(3-3-05查指标责任主体类型.责任主体类型 等于 个人)  30960

//processBranchName:正常结束 ,processBranchId:30961

        }
        ImplementObjtiveSubjectBodyTagRcordDisposeComRespDto retData = new ImplementObjtiveSubjectBodyTagRcordDisposeComRespDto();


        return retData;
    }

    /**
     * D3执行循环处理指标责任主体标签记录(公共)[5966]
     * gen by moon at 2/20/2023, 12:42:41 PM
     */
    @Trace(operationName = "D3执行循环处理指标责任主体标签记录(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementDisposeObjtiveSubjectBodyTagRcordComRespDto implementDisposeObjtiveSubjectBodyTagRcordCom(ImplementDisposeObjtiveSubjectBodyTagRcordComReqDto reqDto) {


        //步骤0: M3执行获取出入参业务字段（特殊方法） - implementAccessParameterBizField
        //ModelCode: receptionService
        ImplementAccessParameterBizFieldRespDto receptionServiceRes = null;
        ImplementAccessParameterBizFieldReqDto receptionServiceReq = new ImplementAccessParameterBizFieldReqDto();
        if (reqDto != null) {
            receptionServiceReq.setTableTypeCode(reqDto.getTableTypeCode());//SimpleFieldAssign//sourceId:693570_1
            receptionServiceReq.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:693571_1
            receptionServiceReq.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:693569_1
        }

        /*M3执行获取出入参业务字段（特殊方法）[5797]  用于特殊方法接收上游入参。 */
        Assert.isNull(receptionServiceReq.getTableTypeCode(), "D3执行循环处理指标责任主体标签记录(公共)-M3执行获取出入参业务字段（特殊方法）-冗余内容表类型编码不能为空", false);
        Assert.isNull(receptionServiceReq.getEntityId(), "D3执行循环处理指标责任主体标签记录(公共)-M3执行获取出入参业务字段（特殊方法）-冗余内容表主键ID不能为空", false);
        Assert.isNull(receptionServiceReq.getEvaluationTemplateId(), "D3执行循环处理指标责任主体标签记录(公共)-M3执行获取出入参业务字段（特殊方法）-冗余评价模板ID不能为空", false);
        receptionServiceRes = nbContTagRcord.implementAccessParameterBizField(receptionServiceReq);


//步骤1: D3查下级指标列表(公共) - querySubordinateObjtiveListCom
        QuerySubordinateObjtiveListComRespDto querySubordinateObjtiveListComRespDto = null;
        QuerySubordinateObjtiveListComReqDto querySubordinateObjtiveListComReqDto = new QuerySubordinateObjtiveListComReqDto();
        if (reqDto != null) {
            querySubordinateObjtiveListComReqDto.setTableTypeCode(reqDto.getTableTypeCode());//SimpleFieldAssign//sourceId:694116_1
            querySubordinateObjtiveListComReqDto.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:694117_1
            querySubordinateObjtiveListComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:694118_1
        }

        /*D3查下级指标列表(公共)[5967]   */
        Assert.isNull(querySubordinateObjtiveListComReqDto.getTableTypeCode(), "D3执行循环处理指标责任主体标签记录(公共)-D3查下级指标列表(公共)-冗余内容表类型编码不能为空", false);
        Assert.isNull(querySubordinateObjtiveListComReqDto.getEntityId(), "D3执行循环处理指标责任主体标签记录(公共)-D3查下级指标列表(公共)-冗余内容表主键ID不能为空", false);
        Assert.isNull(querySubordinateObjtiveListComReqDto.getEvaluationTemplateId(), "D3执行循环处理指标责任主体标签记录(公共)-D3查下级指标列表(公共)-评价模板ID不能为空", false);
        querySubordinateObjtiveListComRespDto = targetContentService.querySubordinateObjtiveListCom(querySubordinateObjtiveListComReqDto);


//步骤2: M3-3-03执行分解指标【循环开始】 - implementDecomposeTargetLoopStart
        //ModelCode: circulationCollections
        for (String circulationCollectionsRes : querySubordinateObjtiveListComRespDto.getTargetObjList()) {


//步骤3: D3执行指标模板责任主体标签记录处理(公共) - implementObjtiveSubjectBodyTagRcordDisposeCom
            ImplementObjtiveSubjectBodyTagRcordDisposeComRespDto implementObjtiveSubjectBodyTagRcordDisposeComRespDto = null;
            ImplementObjtiveSubjectBodyTagRcordDisposeComReqDto implementObjtiveSubjectBodyTagRcordDisposeComReqDto = new ImplementObjtiveSubjectBodyTagRcordDisposeComReqDto();
            if (circulationCollectionsRes != null) {
                implementObjtiveSubjectBodyTagRcordDisposeComReqDto.setObjectiveId(circulationCollectionsRes);//SimpleFieldAssign//sourceId:693558_1
            }
            if (reqDto != null) {
                implementObjtiveSubjectBodyTagRcordDisposeComReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:693559_1
            }

            /*D3执行指标模板责任主体标签记录处理(公共)[5963]   */
            Assert.isNull(implementObjtiveSubjectBodyTagRcordDisposeComReqDto.getObjectiveId(), "D3执行循环处理指标责任主体标签记录(公共)-D3执行指标模板责任主体标签记录处理(公共)-指标ID不能为空", false);
            Assert.isNull(implementObjtiveSubjectBodyTagRcordDisposeComReqDto.getEvaluationTemplateId(), "D3执行循环处理指标责任主体标签记录(公共)-D3执行指标模板责任主体标签记录处理(公共)-冗余评价模板ID不能为空", false);
            implementObjtiveSubjectBodyTagRcordDisposeComRespDto = implementObjtiveSubjectBodyTagRcordDisposeCom(implementObjtiveSubjectBodyTagRcordDisposeComReqDto);


//步骤4: M3-执行【循环结束】 - implementLoopEnd
            //ModelCode: circulationEnd
        }


        ImplementDisposeObjtiveSubjectBodyTagRcordComRespDto retData = new ImplementDisposeObjtiveSubjectBodyTagRcordComRespDto();


        return retData;
    }

    //
}
